1. Field of the Invention
Apparatuses and methods consistent with the present invention relate to accelerating Java translation, by which optimized bytecode can be generated.
2. Description of the Related Art
Java is an object-orientated programming language developed by Sun Microsystems, Inc., which has several significant advantages over related art programming languages, including platform independence, sandbox model security and code compaction. Java code is small, simple and portable across platforms and operating systems.
In related art programming languages, the source code of a program is sent to a compiler which translates the program into machine code or processor instructions, which include native instructions. For example, an instruction compiled for the x86 system can only be executed by the x86 system only.
However, the Java compiler takes a Java program and generates bytecodes. Bytecodes are instructions that look like machine code, but are not specific to any processor. To execute Java bytecode, a Java Virtual Machine is necessary.
The Java Virtual Machine interprets Java bytecode and converts it to equivalent native code. Since bytecode is not specific to any processor, programs in bytecode can run on any architecture as long the Java Virtual Machine is available.
One disadvantage of Java bytecode is a slow execution speed. System-specific programs that run directly on the hardware for which they are compiled run significantly faster than Java bytecode, which must be processed by the Java Virtual Machine. The processor must both convert the Java bytecodes into native instructions in the Java Virtual Machine and execute the native instructions.
There are several techniques for improving the execution speed of Java bytecode; one is to speed up the Java Virtual Machine by a technique called “Just-in-Time” (JIT) compiling, which, however has disadvantages of a slow execution speed and a JIT compile overhead.
To overcome these disadvantages, the use of a Java hardware accelerator has been proposed. The Java hardware accelerator converts Java bytecodes into native codes using a lookup table. That is, the Java hardware accelerator attempts to speed up the execution speed by converting the Java bytecode into the native code stored in the lookup table.
Even with the Java hardware accelerator, there still exist problems of additional memory usage and power consumption. Accordingly, it is desirable to provide a technique capable of achieving the minimum memory usage and low power consumption. What is needed, therefore, is a method for optimizing the process of converting bytecode into native code.